package main

import (
	"strconv"
	"strings"

	//"database/sql"

	"fmt"
	"io/ioutil"
	"net/http"
	"regexp"
)

var getcold = regexp.MustCompile(`开奖号码：<span class="fc-red">(.*?)</span>`)
var getsecold = regexp.MustCompile(` 特别号：<span class="fc-red">(.*?)</span>`)

func main() {
	// "http://www.fjtc.com.cn/Notice-3107?NO=18028"
	resp, err := http.Get("http://www.fjtc.com.cn/Notice-3107?NO=18028")

	if err != nil {
		fmt.Println("http get error.")
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println("http read error")
	}
	bodys := string(body)
	colds := getcold.FindAllStringSubmatch(bodys, -1)
	secolds := getsecold.FindAllSubmatch([]byte(bodys), -1)
	//test := secolds[0][1]
	//tests := fmt.Sprintf("%s", secolds[0][1])
	// fmt.Println(strings.Replace("ababababababab", "ab", "sqn", 5))
	test := strings.Split(colds[0][1], " ")
	//test = strings.Replace(test, ",", "", 1)
	// for k,v :=range test{
	// 	if v ！=" "{
	// 	fmt.Printf(strconv.Atoi(v))
	// 	}
	// }
	var test1 string
	test1 = test[1]
	//fmt.Println(test1)
	//s := "123"
	cold, _ := strconv.Atoi(fmt.Sprintf("%s", test1))
	secold, _ := strconv.Atoi(fmt.Sprintf("%s", secolds[0][1]))
	fmt.Println(cold)
	fmt.Print(secold)
}
